// funciones sueltas
ventanaAncho=screen.width;
ventanaAlto=screen.height;

function init() {
	/* ARTICULOS */
		shortcut.add("Shift+A", function() {
			ventana("articulos/articulos.php","400","350");
	});
		shortcut.add("Shift+B", function() {
			ventana("articulos/borrar.php","500","300");
	});
		shortcut.add("Shift+S", function() {
			ventana("articulos/actualizar.php","400","500");
	});
	
	/* CATEGORIAS  */
		shortcut.add("Shift+C", function() {
			ventana("proveedor.php","400","500");
	});
		shortcut.add("Shift+D", function() {
			ventana("borrar_categoria/bor.php","500","300");
	});
		shortcut.add("Shift+Z", function() {
			ventana("actualiza_categoria/index.php","400","200");
	});
		shortcut.add("Shift+X", function() {
			ventana("cargar_cliente.php","400","500");
	});
		shortcut.add("Shift+V", function() {
			ventana("actualiza_cliente.php","500","600");
	});
		shortcut.add("Shift+F", function() {
           ventana("cargar_categoria.php","300","200");
	});
		shortcut.add("Shift+L", function() {
           ventana("usuario.php","300","220");
	});
		shortcut.add("Shift+K", function() {
           ventana("tipo_usuario.php","300","100");
	});
		shortcut.add("Shift+H", function() {
           ventana("tarjetaCompra.php","300","200");
	});
		shortcut.add("Shift+G", function() {
           ventana("tarjetaVentas.php","300","300");
	});
		shortcut.add("Shift+J", function() {
           ventana("borrar_usuarios/bor.php","500","300");
	});
		shortcut.add("Shift+U", function() {
           ventana("subcategoria.php","300","200");
	});
		shortcut.add("Shift+Y", function() {
           ventana("borrar_sub_categoria/bor.php","500","300");
	});
}
window.onload=init();

function ventana(pagina, ventana, ancho, alto, scrollbar, maxi){
	window.open(pagina,ventana,"height="+alto+",width="+ancho+", status=0 ,toolbar=0, scrollbars="+scrollbar+", resizable="+maxi+"");
}

function centrar() { 
	try{
		a=(screen.width-document.body.clientWidth) / 2;
		b=(screen.height-document.body.clientHeight) / 2; 
		moveTo(a,b); 
	}catch(e){
		alert("Error en funcion centrar(): "+e);
	}
}

function mayuscula(Ncampo)
{
 try{
 	document.getElementById(Ncampo).value=document.getElementById(Ncampo).value.toUpperCase();
	//document.forms[0].Ncampo.value=document.forms[0].Ncampo.value.toUpperCase();
 }catch(e){
 	alert("Error en funcion mayuscula: "+e.description);
 }
}

//onKeyPress="return OnlyNumber(event);"
function OnlyNumber(e)
{
    try{
        var key;
        if(window.event) // IE
        {
            key = e.keyCode;
        }
        else if(e.which) // Netscape/Firefox/Opera
        {
            key = e.which;
        }
        if (key < 48 || key > 57)
        {
            return false;
        }
        return true;
    }
    catch(e){
        alert("Error en funcion onlyNumber(): " + e.description);
    }
}

function letrasynumeros(myfield, e, dec) {
	var key; 
	var keychar;
	if (window.event) 
		key = window.event.keyCode; 
	else if (e) 
		key = e.which;
	else 
		return true; 
	keychar = String.fromCharCode(key);
	// control keys
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) 
		return true;
	// numbers
	else if ((("0123456789").indexOf(keychar) > -1)) 
		return true;
	// decimalpoint jump
	else if (dec && (keychar == ".")) { 
		myfield.form.elements[dec].focus(); 
		return false; 
	}
	else 
		return false; 
} 


